package cn.iocoder.yudao.module.digital.dal.mysql.patent;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.digital.dal.dataobject.patent.PatentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.digital.controller.admin.patent.vo.*;

/**
 * 专利信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface PatentMapper extends BaseMapperX<PatentDO> {

    default PageResult<PatentDO> selectPage(PatentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PatentDO>()
                .likeIfPresent(PatentDO::getPatentName, reqVO.getPatentName())
                .eqIfPresent(PatentDO::getAffiliatedUnit, reqVO.getAffiliatedUnit())
                .eqIfPresent(PatentDO::getPatentType, reqVO.getPatentType())
                .eqIfPresent(PatentDO::getPatentScope, reqVO.getPatentScope())
                .eqIfPresent(PatentDO::getPatentStatus, reqVO.getPatentStatus())
                .eqIfPresent(PatentDO::getApplicationNumber, reqVO.getApplicationNumber())
                .betweenIfPresent(PatentDO::getApplicationDate, reqVO.getApplicationDate())
                .eqIfPresent(PatentDO::getPublicationNumber, reqVO.getPublicationNumber())
                .betweenIfPresent(PatentDO::getPublicationDate, reqVO.getPublicationDate())
                .eqIfPresent(PatentDO::getAuthorizationNumber, reqVO.getAuthorizationNumber())
                .betweenIfPresent(PatentDO::getAuthorizationDate, reqVO.getAuthorizationDate())
                .eqIfPresent(PatentDO::getApplicant, reqVO.getApplicant())
                .eqIfPresent(PatentDO::getPatentHolder, reqVO.getPatentHolder())
                .eqIfPresent(PatentDO::getIsInvalid, reqVO.getIsInvalid())
                .eqIfPresent(PatentDO::getCooperationType, reqVO.getCooperationType())
                .eqIfPresent(PatentDO::getIsServicePatent, reqVO.getIsServicePatent())
                .eqIfPresent(PatentDO::getSchoolSignature, reqVO.getSchoolSignature())
                .eqIfPresent(PatentDO::getIsPctPatent, reqVO.getIsPctPatent())
                .betweenIfPresent(PatentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PatentDO::getRemark, reqVO.getRemark())
                .eqIfPresent(PatentDO::getReserved1, reqVO.getReserved1())
                .eqIfPresent(PatentDO::getReserved2, reqVO.getReserved2())
                .eqIfPresent(PatentDO::getReserved3, reqVO.getReserved3())
                .eqIfPresent(PatentDO::getReserved4, reqVO.getReserved4())
                .eqIfPresent(PatentDO::getReserved5, reqVO.getReserved5())
                .orderByDesc(PatentDO::getId));
    }

}